<template>
    <view class="pub_page pub_ecology_index">
        <pub-head :headerConfig="headerConfig"></pub-head>
        <pub-tabbar :active="1"></pub-tabbar>
        <div class="page_box">
            <div class="tool_div">
                <div class="tlis" v-for="(li, key) in list" :key="key">
                    <pub-image class="t_img" :src="li.src" mode="widthFix" @click="li.isShow = !li.isShow" />
                    <div :class="key==0?'lis_other':'lis'" v-if="li.isShow">
                        <div class="li" v-for="(cli, ckey) in li.list" :key="ckey" @click.stop="listClick('jump', cli)">
                            <pub-image class="img" :src="cli.src" mode="widthFix" />
                            <div class="text">{{ cli.name }}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </view>
</template>

<script>
export default {
    data() {
        return {
            headerConfig: {
                title: '生态',//标题栏内容
            },
            list: [{
                src: '../../static/aimg/img_66.png',
                isShow: false,
                list: [
                    { name: '', jump: '', src: '../../static/aimg/img_67.png' },
                    { name: '', jump: '', src: '../../static/aimg/img_68.png' },
                ]
            }, {
                src: '../../static/aimg/img_69.png',
                isShow: false,
                list: [
                    { name: '厂长巡逻', jump: '/pages/gameDts/page/game', src: '../../static/aimg/img_70.png' },
                    { name: '抛绣球', jump: '', src: '../../static/aimg/img_71.png' },
                ]
            }, {
                src: '../../static/aimg/img_72.png',
                isShow: false,
                list: [
                    { name: '精品荟萃', jump: '', src: '../../static/aimg/img_73.png' },
                ]
            }],
        };
    },
    onLoad() {
        // this.getUserInfo();
        // this.getGameOpen();
    },
    methods: {
        // async getUserInfo() {
        //     if (this.userInfo == '') {
        //         this.$comFun.openLoading();
        //     }
        //     const res = await this.$request.get('user/getInfo', {});
        //     // console.log(res);
        //     if (this.userInfo == '') {
        //         this.$comFun.closeLoading();
        //     }
        //     if (res.code == 200) {
        //         this.userInfo = res.result;
        //     }
        // },
        // async getGameOpen() {
        //     let configRes = await getApp().getConfigList();
        //     // console.log(configRes);
        //     // if (configRes.isJdGame == '1') {
        //     //     this.setGameJump(0, '弹弹觉醒', '/pages/game/jddts/game');
        //     // }
        //     if (configRes.isWangGame == '1') {
        //         this.setGameJump(0, '淘英雄', '/pages/gamewt/wtdts/game');
        //     }
        //     if (configRes.isSuGame == '1') {
        //         this.setGameJump(0, '君临七城', '/pages/gamewt_two/wtdts/game');
        //     }
        //     this.$forceUpdate();
        // },
        // setGameJump(listKey, name, url) {
        //     let findIndex = this.list[listKey].list.findIndex(li => {
        //         return li.name == name;
        //     })
        //     if (findIndex != -1) {
        //         this.list[listKey].list[findIndex].jump = url;
        //     }
        // },
        listClick(type, data_1) {
            switch (type) {
                case 'jump':
                    if (data_1.jump) {
                        this.$comFun.openWin(data_1.jump);
                    } else {
                        this.$comFun.toast('暂未开放');
                    }
                    break;
            }
        }
    },
};
</script>

<style lang="scss" scoped>
@import "@/common/css/ecology.scss";
</style>
